package com.choudou5.spider.config;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * @name 搜索关键字参数
 * @author choudou5
 * @date 2018-08-21
 */
public class SearchKeywordParam implements Serializable {

    private String name;    //关键词
    private Integer maxPage = 30;    //最大分页
    private String encoding = "UTF-8";

    public String getName() {
        try {
            return URLEncoder.encode(name, getEncoding());
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getMaxPage() {
        return maxPage;
    }

    public void setMaxPage(Integer maxPage) {
        this.maxPage = maxPage;
    }

    public String getEncoding() {
        return encoding==null?"UTF-8":encoding;
    }

    public void setEncoding(String encoding) {
        this.encoding = encoding;
    }
}
